#include "SimpleCompletion.h"

void completion_done(rt_sem_t sem){
	while (rt_list_len(&(sem->parent.suspend_thread)) != 0 ){
		rt_sem_release(sem);
	}
}

rt_err_t completion_wait(rt_sem_t sem, rt_int32_t timeout) {
	 // 独占资源，如果有额外资源应该被清空
		while (sem->value != 0 ) { rt_sem_trytake(sem); }
    return rt_sem_take(sem, 2000);
}
